<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0,
           maximum-scale=1.0, minimum-scale=1.0"/>
    <title>angular实现标签显示页面($sce)</title>
    <script src="js/angular.js"></script>
</head>
<body>
    <div ng-app="myApp">
        <div ng-controller="fristControl">
            <div ng-bind-html="text"></div>
            <div ng-bind-html="detail()"></div>
        </div>
    </div>
</body>
<script>
    /*说明
    * $sce 实现了数据请求页面直接绑定页面显示的效果
    * */
    var app=angular.module('myApp',[]);
    app.controller("fristControl",['$scope','$timeout','$sce','$http',
        function ($scope,$timeout, $sce,$http) {
            $scope.name='hello';
            $scope.text=$sce.trustAsHtml('<h1>你好</h1>');
            var mUrl="http://www.phonegap100.com/appapi.php?a=getPortalArticle&aid=338&callback=JSON_CALLBACK";
            $http.jsonp(mUrl)
                    .success(function (data) {
                        $scope.detail= function () {
                            return $sce.trustAsHtml(data.result[0].content);
                        }
                    })
                    .error(function () {
                        alert('失败')
                    });
        }]);

</script>
</html>